;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2022 Stephen Paul Weber <singpolyma@singpolyma.net>
;;; This file is not part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages iredis)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix build-system python)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages check)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages time))

(define-public python-mistune
  (package
    (name "python-mistune")
    (version "2.0.3")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "mistune" version))
              (sha256
               (base32
                "0l3yddym9mg94mfssc21xbs00vwsn8154iiasnvm6sqmnr35nq6p"))))
    (build-system python-build-system)
    (arguments
     '(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'add-setup-py
           (lambda args
             (with-output-to-file "setup.py"
               (lambda _ (display "from setuptools import setup\nif __name__ == '__main__':\n    setup()"))))))))
    (native-inputs (list python-setuptools))
    (home-page "https://github.com/lepture/mistune")
    (synopsis "A sane Markdown parser with useful plugins and renderers")
    (description
     "This package provides a sane Markdown parser with useful plugins and renderers")
    (license license:bsd-3)))

(define-public iredis
  (package
    (name "iredis")
    (version "1.12.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "iredis" version))
              (sha256
               (base32
                "10fdf6w6q21960l0bk4n5aa03sfk6877bgprnr43v80avfa100y3"))))
    (build-system python-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'loosen-dependencies
           (lambda args
             (substitute* "setup.py"
               (("wcwidth==0.1.9") "wcwidth>=0.1.8")
               (("5.1.0") "3.0.0")))))))
    (propagated-inputs (list python-click-7
                             python-configobj
                             python-importlib-resources
                             python-mistune
                             python-packaging
                             python-pendulum
                             python-prompt-toolkit
                             python-pygments
                             python-redis
                             python-wcwidth))
    (native-inputs
      (list python-pytest python-pexpect))
    (home-page "https://github.com/laixintao/iredis")
    (synopsis
     "Terminal client for Redis with auto-completion and syntax highlighting.")
    (description
     "Terminal client for Redis with auto-completion and syntax highlighting.")
    (license license:bsd-3)))
